package com.weirong.smartvault.common.tools.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Optional;

@Getter
@AllArgsConstructor
public enum RoleType {

    BACK_SERVICE_ROLE("后台角色", 1),

    CONTROLLER_SERVICE_ROLE("控制台角色", 2);

    private final String name;

    private final int id;

    public static Optional<RoleType> getById(int id)
    {
        for(RoleType rt : RoleType.values())
        {
            if(rt.getId() == id) return Optional.of(rt);
        }
        return Optional.empty();
    }

}
